[Alerting v2] Add quick edit rule flyout to the rules list#268164
[Alerting v2] Add quick edit rule flyout to the rules list#268164yiannisnikolopoulos merged 5 commits into
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR introduces a quick-edit flyout for inline rule updates in alerting v2. The feature adds a new 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| const lens = useService(PluginStart('lens')) as LensPublicStart; | ||
|
|
||
| const ruleFormServices = useMemo( | ||
| () => ({ http, data, dataViews, notifications, application, lens }), |
There was a problem hiding this comment.
are all of these being used by the context provider?
There was a problem hiding this comment.
Only http, data, and dataViews are actually consumed by the field groups in the quick edit flow. lens is only used by the PreviewChart component (not rendered here), and notifications/application aren't used by any of the field group components. However, the RuleFormServices interface in the shared package requires all six so we can't drop them without making those fields optional in the type.
baileycash-elastic
left a comment
There was a problem hiding this comment.
Can you add scout tests for this flow?
💛 Build succeeded, but was flaky
Failed CI Steps
Test Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
|
…m state (#268774) ## Summary Closes #268771 Adds `ComposeDiscoverFlyout`, the stepped Edit Form flyout for v2 rule authoring. This is PR B in a series; PR A (#268739) adds `HorizontalMinimalStepper` as a foundation. **What's in this PR:** - `ComposeDiscoverFlyout` component with a 3-step form: **Alert Condition → Details & Artifacts → Notifications** - Complete RHF migration: all submitted values (`name`, `tags`, `schedule`, `lookback`, `timeField`, `grouping`, `query`, delays) live in `useForm<FormValues>()`; reducer owns only UI state (`step`, `childOpen`, `yamlMode`, `queryCommitted`, etc.) - **Create mode** — wired to `useCreateRule` mutation; entry point is the new **"Create in flyout"** button on the rules list (alongside **"Create rule"** which still navigates to the full-page form) - **Edit mode** — wired to `useUpdateRule`; entry point is the edit icon on any rule row (replaces `QuickEditRuleFlyout`) - **Discover Sandbox** — child flyout with a single ES|QL editor, Lens histogram, and data grid; opens via "Open query editor" / "Edit query" in the Alert Condition step - **YAML preview** — toggle in header shows read-only CodeEditor with rule YAML; editing round-trip is deferred - Reuses `RuleDetailsFieldGroup` and `RuleExecutionFieldGroup` from PR #268164 **What's NOT in this PR (deferred):** - No Recovery Condition step (PR E) - No tracking toggle or split-query support - Notifications step is a placeholder callout - Runbook URL / Dashboard link are disabled stubs - Sandbox UI unpolished (redesign in PR C) - YAML round-trip editing deferred ### State architecture ``` useForm<FormValues>() ← submitted values: name, tags, schedule, query, timeField, grouping, delays useReducer(uiReducer) ← UI only: step, childOpen, fullQuery, yamlMode, queryCommitted, sandboxDateStart/End ``` One bridge: when the user clicks **Apply changes** in the Sandbox, a `useEffect` syncs `uiState.fullQuery → setValue('evaluation.query.base', ...)`. Everything else writes directly to RHF via `useFormContext()`. --- ## Test plan ### Prerequisites Start Elasticsearch: ```bash cd ~/__projects__/kibana-dev/pr-b-rhf-form node scripts/es snapshot --license=trial ``` Start Kibana (Node 24 required): ```bash export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && nvm use 24 KBN_USE_RSPACK=true yarn start \ --server.port=5603 \ --server.basePath=/ifh \ --server.rewriteBasePath=true ``` `config/kibana.dev.yml`: ```yaml xpack.alerting_v2.enabled: true dev.basePathProxyTarget: 5604 mockIdpPlugin.enabled: false ``` Navigate to: `http://localhost:5603/ifh/app/management/alertingV2/rules` --- ### Create flow - [ ] Click **Create in flyout** (next to the primary "Create rule" button) — flyout opens in create mode; Discover Sandbox opens alongside it automatically - [ ] Verify 3 steps in the header stepper: Alert Condition, Details & Artifacts, Notifications - [ ] In the Sandbox: type a query (e.g. `FROM logs-* | STATS count = COUNT(*) BY host.name | WHERE count > 0`), click **Search** — verify histogram and results grid appear - [ ] Click **Apply changes** — Sandbox closes; Alert Condition step shows the committed query summary - [ ] Change the **Time field** dropdown — verify it reflects in the form - [ ] Adjust **schedule** and **lookback** via the schedule fields - [ ] Click **Next** → **Details & Artifacts**: fill in rule name and tags via the standard field group - [ ] Click **Next** → **Notifications**: verify placeholder callout appears (not wired yet — expected) - [ ] Click **Create rule** — verify rule appears in the list with correct name, tags, and schedule - [ ] Verify the primary **Create rule** button (filled, left of "Create in flyout") still navigates to the full-page form ### Edit flow - [ ] Click the edit (pencil) icon on an existing rule — flyout opens in edit mode, pre-populated with that rule's values - [ ] Modify the rule name in Details & Artifacts - [ ] Click **Save rule** — verify the rule updates and the change appears in the list ### YAML preview - [ ] Toggle YAML mode in the flyout header — stepper collapses; CodeEditor shows read-only rule YAML - [ ] Fill in form fields, toggle YAML mode — verify YAML reflects the current values ### Edge cases - [ ] Open the Sandbox, edit the query, close without clicking **Apply changes** — verify the Alert Condition step still shows the previously committed query - [ ] Verify **Next** is disabled while the Sandbox is open --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
…m state (elastic#268774) ## Summary Closes elastic#268771 Adds `ComposeDiscoverFlyout`, the stepped Edit Form flyout for v2 rule authoring. This is PR B in a series; PR A (elastic#268739) adds `HorizontalMinimalStepper` as a foundation. **What's in this PR:** - `ComposeDiscoverFlyout` component with a 3-step form: **Alert Condition → Details & Artifacts → Notifications** - Complete RHF migration: all submitted values (`name`, `tags`, `schedule`, `lookback`, `timeField`, `grouping`, `query`, delays) live in `useForm<FormValues>()`; reducer owns only UI state (`step`, `childOpen`, `yamlMode`, `queryCommitted`, etc.) - **Create mode** — wired to `useCreateRule` mutation; entry point is the new **"Create in flyout"** button on the rules list (alongside **"Create rule"** which still navigates to the full-page form) - **Edit mode** — wired to `useUpdateRule`; entry point is the edit icon on any rule row (replaces `QuickEditRuleFlyout`) - **Discover Sandbox** — child flyout with a single ES|QL editor, Lens histogram, and data grid; opens via "Open query editor" / "Edit query" in the Alert Condition step - **YAML preview** — toggle in header shows read-only CodeEditor with rule YAML; editing round-trip is deferred - Reuses `RuleDetailsFieldGroup` and `RuleExecutionFieldGroup` from PR elastic#268164 **What's NOT in this PR (deferred):** - No Recovery Condition step (PR E) - No tracking toggle or split-query support - Notifications step is a placeholder callout - Runbook URL / Dashboard link are disabled stubs - Sandbox UI unpolished (redesign in PR C) - YAML round-trip editing deferred ### State architecture ``` useForm<FormValues>() ← submitted values: name, tags, schedule, query, timeField, grouping, delays useReducer(uiReducer) ← UI only: step, childOpen, fullQuery, yamlMode, queryCommitted, sandboxDateStart/End ``` One bridge: when the user clicks **Apply changes** in the Sandbox, a `useEffect` syncs `uiState.fullQuery → setValue('evaluation.query.base', ...)`. Everything else writes directly to RHF via `useFormContext()`. --- ## Test plan ### Prerequisites Start Elasticsearch: ```bash cd ~/__projects__/kibana-dev/pr-b-rhf-form node scripts/es snapshot --license=trial ``` Start Kibana (Node 24 required): ```bash export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && nvm use 24 KBN_USE_RSPACK=true yarn start \ --server.port=5603 \ --server.basePath=/ifh \ --server.rewriteBasePath=true ``` `config/kibana.dev.yml`: ```yaml xpack.alerting_v2.enabled: true dev.basePathProxyTarget: 5604 mockIdpPlugin.enabled: false ``` Navigate to: `http://localhost:5603/ifh/app/management/alertingV2/rules` --- ### Create flow - [ ] Click **Create in flyout** (next to the primary "Create rule" button) — flyout opens in create mode; Discover Sandbox opens alongside it automatically - [ ] Verify 3 steps in the header stepper: Alert Condition, Details & Artifacts, Notifications - [ ] In the Sandbox: type a query (e.g. `FROM logs-* | STATS count = COUNT(*) BY host.name | WHERE count > 0`), click **Search** — verify histogram and results grid appear - [ ] Click **Apply changes** — Sandbox closes; Alert Condition step shows the committed query summary - [ ] Change the **Time field** dropdown — verify it reflects in the form - [ ] Adjust **schedule** and **lookback** via the schedule fields - [ ] Click **Next** → **Details & Artifacts**: fill in rule name and tags via the standard field group - [ ] Click **Next** → **Notifications**: verify placeholder callout appears (not wired yet — expected) - [ ] Click **Create rule** — verify rule appears in the list with correct name, tags, and schedule - [ ] Verify the primary **Create rule** button (filled, left of "Create in flyout") still navigates to the full-page form ### Edit flow - [ ] Click the edit (pencil) icon on an existing rule — flyout opens in edit mode, pre-populated with that rule's values - [ ] Modify the rule name in Details & Artifacts - [ ] Click **Save rule** — verify the rule updates and the change appears in the list ### YAML preview - [ ] Toggle YAML mode in the flyout header — stepper collapses; CodeEditor shows read-only rule YAML - [ ] Fill in form fields, toggle YAML mode — verify YAML reflects the current values ### Edge cases - [ ] Open the Sandbox, edit the query, close without clicking **Apply changes** — verify the Alert Condition step still shows the previously committed query - [ ] Verify **Next** is disabled while the Sandbox is open --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
…m state (elastic#268774) ## Summary Closes elastic#268771 Adds `ComposeDiscoverFlyout`, the stepped Edit Form flyout for v2 rule authoring. This is PR B in a series; PR A (elastic#268739) adds `HorizontalMinimalStepper` as a foundation. **What's in this PR:** - `ComposeDiscoverFlyout` component with a 3-step form: **Alert Condition → Details & Artifacts → Notifications** - Complete RHF migration: all submitted values (`name`, `tags`, `schedule`, `lookback`, `timeField`, `grouping`, `query`, delays) live in `useForm<FormValues>()`; reducer owns only UI state (`step`, `childOpen`, `yamlMode`, `queryCommitted`, etc.) - **Create mode** — wired to `useCreateRule` mutation; entry point is the new **"Create in flyout"** button on the rules list (alongside **"Create rule"** which still navigates to the full-page form) - **Edit mode** — wired to `useUpdateRule`; entry point is the edit icon on any rule row (replaces `QuickEditRuleFlyout`) - **Discover Sandbox** — child flyout with a single ES|QL editor, Lens histogram, and data grid; opens via "Open query editor" / "Edit query" in the Alert Condition step - **YAML preview** — toggle in header shows read-only CodeEditor with rule YAML; editing round-trip is deferred - Reuses `RuleDetailsFieldGroup` and `RuleExecutionFieldGroup` from PR elastic#268164 **What's NOT in this PR (deferred):** - No Recovery Condition step (PR E) - No tracking toggle or split-query support - Notifications step is a placeholder callout - Runbook URL / Dashboard link are disabled stubs - Sandbox UI unpolished (redesign in PR C) - YAML round-trip editing deferred ### State architecture ``` useForm<FormValues>() ← submitted values: name, tags, schedule, query, timeField, grouping, delays useReducer(uiReducer) ← UI only: step, childOpen, fullQuery, yamlMode, queryCommitted, sandboxDateStart/End ``` One bridge: when the user clicks **Apply changes** in the Sandbox, a `useEffect` syncs `uiState.fullQuery → setValue('evaluation.query.base', ...)`. Everything else writes directly to RHF via `useFormContext()`. --- ## Test plan ### Prerequisites Start Elasticsearch: ```bash cd ~/__projects__/kibana-dev/pr-b-rhf-form node scripts/es snapshot --license=trial ``` Start Kibana (Node 24 required): ```bash export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && nvm use 24 KBN_USE_RSPACK=true yarn start \ --server.port=5603 \ --server.basePath=/ifh \ --server.rewriteBasePath=true ``` `config/kibana.dev.yml`: ```yaml xpack.alerting_v2.enabled: true dev.basePathProxyTarget: 5604 mockIdpPlugin.enabled: false ``` Navigate to: `http://localhost:5603/ifh/app/management/alertingV2/rules` --- ### Create flow - [ ] Click **Create in flyout** (next to the primary "Create rule" button) — flyout opens in create mode; Discover Sandbox opens alongside it automatically - [ ] Verify 3 steps in the header stepper: Alert Condition, Details & Artifacts, Notifications - [ ] In the Sandbox: type a query (e.g. `FROM logs-* | STATS count = COUNT(*) BY host.name | WHERE count > 0`), click **Search** — verify histogram and results grid appear - [ ] Click **Apply changes** — Sandbox closes; Alert Condition step shows the committed query summary - [ ] Change the **Time field** dropdown — verify it reflects in the form - [ ] Adjust **schedule** and **lookback** via the schedule fields - [ ] Click **Next** → **Details & Artifacts**: fill in rule name and tags via the standard field group - [ ] Click **Next** → **Notifications**: verify placeholder callout appears (not wired yet — expected) - [ ] Click **Create rule** — verify rule appears in the list with correct name, tags, and schedule - [ ] Verify the primary **Create rule** button (filled, left of "Create in flyout") still navigates to the full-page form ### Edit flow - [ ] Click the edit (pencil) icon on an existing rule — flyout opens in edit mode, pre-populated with that rule's values - [ ] Modify the rule name in Details & Artifacts - [ ] Click **Save rule** — verify the rule updates and the change appears in the list ### YAML preview - [ ] Toggle YAML mode in the flyout header — stepper collapses; CodeEditor shows read-only rule YAML - [ ] Fill in form fields, toggle YAML mode — verify YAML reflects the current values ### Edge cases - [ ] Open the Sandbox, edit the query, close without clicking **Apply changes** — verify the Alert Condition step still shows the previously committed query - [ ] Verify **Next** is disabled while the Sandbox is open --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
Summary
Screen.Recording.2026-05-07.at.4.27.34.PM.mov
Closes #265896
Adds a quick edit flyout to the v2 alerting rule list page, allowing users to edit a subset of rule fields inline without navigating to the full edit page.
Entry points
Editable fields
Read-only fields
Changes
New files:
quick_edit_rule_flyout.tsx— the quick edit flyout componentquick_edit_rule_flyout.test.tsx— unit tests@kbn/alerting-v2-rule-formpackage:kind_field.tsx— addeddisabledandcompactprops. Compact mode renders a flatEuiCheckableCardwith anEuiIconTiptooltip instead of inline description textgui_rule_form.tsx— addedisEditingprop to disableKindFieldin edit moderule_form.tsx— propagatesisEditingbased onruleIdpresenceRuleDetailsFieldGroup,ConditionFieldGroup,RuleExecutionFieldGroup,AlertConditionsFieldGroup,KindField) for modular reusealerting_v2plugin:rule_summary_flyout.tsx— added pencil icon +onQuickEditprop, bumped flyout size tomrules_list_table.tsx— added pencil icon in actions columnrules_list_table_container.tsx— wires quick edit state with mutual exclusivity (only one flyout open at a time), useskey={rule.id}to force re-mount on rule switchrule_summary_flyout.test.tsx— added missingonQuickEditprop + test for pencil iconFigma design for reference: URL